<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        document.onkeydown = function (e) {
            // console.log(e.key);   // e.key 记录键盘上的键值
            // console.log(e.keyCode);   // e.keyCode  记录键值对应的ASCII值 --- 只有大写(小写也是大写)

            // 回车事件
            if (e.keyCode === 13) {
                console.log('回车事件');
            }

            // 组合键
            // console.log(e.ctrlKey);
            // console.log(e.altKey);
            // console.log(e.shiftKey);


            // ctrl + enter
            if (e.ctrlKey && e.keyCode === 13) {
                console.log('组合键');
            }

        }


    </script>

</body>

</html>